<?php

Raise::load('core.helper.convert.RaiseUnitConverter');

/**
 * RaiseBaseConverter class
 * for conversion between number bases
 * 
 * @author Sam-Mauris Yong / hellclanner at live dot com
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package phpraise.core.helper.convert.unit
 * @since 1.2
 */
class RaiseBaseConverter extends RaiseUnitConverter {
    
    /**
     * Binary Unit
     */
    const BINARY = 2;
    
    /**
     * Decimal Unit
     */
    const DECIMAL = 10;
    
    /**
     * Hexadecimal Unit
     */
    const HEXADECIMAL = 16;
    
    /**
     * Octal Unit
     */
    const OCTAL = 8;
    
    /**
     * Convert the subject between number bases
     * @param mixed $subject
     * @return mixed 
     */
    public function convert($subject) {
        return base_convert($subject, $this->from(), $this->to());
    }
    
}